package com.bruce.rpc.connection;

import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

/**
 * @author Bruce
 */
public class ZkConnection {
    private String zkServer;
    private int sessionTimeout;
    public ZkConnection(){
        super();
        this.zkServer = "localhost:2181";
        this.sessionTimeout = 10000;
    }

    public ZkConnection(String zkServer, int sessionTimeout) {
        this.zkServer = zkServer;
        this.sessionTimeout = sessionTimeout;
    }

    public ZooKeeper getConnection() throws IOException {
        return new ZooKeeper(zkServer, sessionTimeout, watchedEvent -> {});
    }


}
